package com.napenalki.toto.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

@Entity
@Table(name = "MATCH_EVENT")
public class Match extends Event {

    private String team1Name;
    private String team2Name;
    private Stages stage;

    public Match() {
        super();
    }
    
    public Match(Date date, boolean isLocked, String result, String team1Name,
            String team2Name, Stages stage) {
        super(date, isLocked, result);
        this.team1Name = team1Name;
        this.team2Name = team2Name;
        this.stage = stage;
    }    

    public Match(int id, Date date, boolean isLocked, String result,
        String team1Name, String team2Name, Stages stage) {
        super(id, date, isLocked, result);
        this.team1Name = team1Name;
        this.team2Name = team2Name;
        this.stage = stage;
    }

    @Column(name = "TEAM1")
    @NotNull
    public String getTeam1Name() {
        return team1Name;
    }

    public void setTeam1Name(String team1Name) {
        this.team1Name = team1Name;
    }

    @Column(name = "TEAM2")
    @NotNull
    public String getTeam2Name() {
        return team2Name;
    }

    public void setTeam2Name(String team2Name) {
        this.team2Name = team2Name;
    }

    @Column(name = "STAGE")
    @NotNull
    @Enumerated(EnumType.STRING)
    public Stages getStage() {
        return stage;
    }

    public void setStage(Stages stage) {
        this.stage = stage;
    }
    
    @Override
    public String toString() {
        return team1Name + " - " + team2Name;
    }
}
